from datetime import datetime
from typing import Optional

from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel


class DemoModel(BaseModel):
    """
    测试模型
    """

    model_config = ConfigDict(alias_generator=to_camel, from_aattributes=True)

    id: Optional[int] = Field(default=None, description='ID')
    code: str = Field(description='编码')
    name: str = Field(description='名称')
    age: int = Field(description='年龄')
    money: float = Field(description='金额')
    create_by: Optional[str] = Field(default=None, description='创建者')
    create_at: Optional[datetime] = Field(default=None, description='创建时间')
    update_by: Optional[str] = Field(default=None, description='更新者')
    update_at: Optional[datetime] = Field(default=None, description='更新时间')
